
<?php
session_start();
require("conn.php");
$ten=$_POST["ten"];
$chude=$_POST["chude"];
$dongia=$_POST["dongia"];
$soluong=$_POST["soluong"];
//$chude=$_POST["chude"];
$mota=$_POST["mota"];
$motact=$_POST["motact"];
$lienhe=$_POST["lienhe"];
$hinh1=$_FILES["hinh1"]["name"];
$hinh2=$_FILES["hinh2"]["name"];
$hinh3=$_FILES["hinh3"]["name"];
$sql="INSERT INTO `ajax`.`sanpham` (
`ma` ,
`ten` ,
`chude` ,
`dongia` ,
`soluong` ,
`hinh1` ,
`hinh2` ,
`hinh3` ,
`mota` ,
`motact` ,
`lienhe` 
)
VALUES (
NULL , '$ten', '$chude', '$dongia', '$soluong', '$hinh1','$hinh2','$hinh3', '$mota', '$motact', '$lienhe'
)";
/*if (($_FILES["tenfile"]["type"] =="image/gif")
|| ($_FILES["tenfile"]["type"] == "image/jpeg")
|| ($_FILES["tenfile"]["type"] == "image/pjpeg"))
{
echo("rar");
}*/
		if(move_uploaded_file($_FILES["hinh1"]["tmp_name"],"../hinh/hinhsanpham/".$hinh1) && move_uploaded_file($_FILES["hinh2"]["tmp_name"],"../hinh/hinhsanpham/".$hinh2) && move_uploaded_file($_FILES["hinh3"]["tmp_name"],"../hinh/hinhsanpham/".$hinh3))
		{
			mysql_query($sql);
			echo("thanh cong");
			//header("location:index.php");
		}
		else
		{
		echo("k thanh cong");
		}

?>